package com.funtl.itoken.service.admin.controller;

import com.funtl.itoken.common.domain.TbSysUser;
import com.funtl.itoken.common.dto.BaseResult;
import com.funtl.itoken.service.admin.service.AdminService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping(value = "/v1/admins")
@RestController
public class AdminController {
    @Autowired
    private AdminService adminService;

    @GetMapping("page/{pageNum}/{pageSize}")
    public BaseResult page(@PathVariable(required = true) int pageNum,
                           @PathVariable(required = true) int pageSize,
                           @RequestParam(required = false) TbSysUser tbSysUser) {

        PageInfo pageInfo = adminService.selectPage(pageNum, pageSize, tbSysUser);
        List list = pageInfo.getList();


        return BaseResult.ok(list);
    }
}
